using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


namespace NTTHAO.CommonWeb
{
    /// <summary>
    /// Summary description for Constant
    /// </summary>
    /// 
    public class Constant
    {
        private Constant()
        {

        }

        //public const string SITE = "Bichano";
        public static int DEFAULT_LANGUAGE
        {
            get
            {
                NTTHAO.Web.BL.CommonPage.CommonSite site = NTTHAO.CommonWeb.WebGlobal.GetSite();
                return site == null ? 1 : site.DefaultLanguage;
            }
        }
        public static readonly string SITE_SESSION = "SITE_SESSION";
        public static readonly string LANGUAGE_SESSION = "LANGUAGE_SESSION";
        public static readonly string LANGUAGE_ID_SESSION = "LANGUAGE_ID_SESSION";
        public static readonly string PAGE_VIEW_NAME = "PAGE_VIEW";
        public static readonly string ONLINE_NAME = "ONLINE";

        public static readonly int NUM_ROW_PER_PAGE = 10;

        public static readonly string NO_IMAGE = "noimage.jpg";

        public static readonly int MAP_IMAGE_MINI_WIDTH = 100;
        public static readonly int MAP_IMAGE_MINI_HEIGHT = 100;

        public static readonly string WEB_PARTS_FOLDER = "WebParts";
        
        public static string UPLOAD_FILE_PATH
        {
            get
            {
                NTTHAO.Web.BL.CommonPage.CommonSite site = NTTHAO.CommonWeb.WebGlobal.GetSite(System.Web.HttpContext.Current.Session);
                string siteID = site != null ? site.SiteID : System.Configuration.ConfigurationManager.AppSettings["SITEID"];

                return "resources/uploaded/" + siteID + "/";
            }
        }

        public static string LOGO_IMAGE_FILE
        {
            get
            {
                string filePath = Constant.UPLOAD_FILE_PATH + "Files/" + "logo.png";
                if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("/" + filePath)))
                {
                    return filePath;
                }
                return null;
            }
        }

        public static string MASK_IMAGE_FILE
        {
            get
            {
                string filePath = Constant.UPLOAD_FILE_PATH + "Files/" + "mask.png";
                if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("/" + filePath)))
                {
                    return filePath;
                }
                return null;
            }
        }

        public static bool ADD_LAYER_MASK
        {
            get
            {
                return "1".Equals(ConfigValues.GetConfigValue("ADD_LAYER_MASK")) && Constant.MASK_IMAGE_FILE != null;
            }
        }
        
        //public static string UPLOAD_FILE_PATH = "resources/uploaded/" + NTTHAO.CommonWeb.WebGlobal.GetSite(System.Web.HttpContext.Current.Session).SiteID + "/";
        //public static readonly string UPLOAD_FILE_PATH = "resources/uploaded/vietgiaan1/";
        public readonly static string IMAGE_FILE_EXTENTIONS = ".jpg .jpeg .jpe .png .gif .bmp";
        //public readonly static string RESIZABLE_IMAGE_FILE_EXTENTIONS = ".png .jpg .jpeg .jpe .bmp .gif";
        public readonly static string FLASH_FILE_EXTENTIONS = ".swf";
        public readonly static string FLASH_VIDEO_FILE_EXTENTIONS = ".flv";

    }
}